﻿var clicked = false;
function CheckBrowser() {
    if (clicked == false) {
        //Browser closed
    }
    else {
        //redirected 
        clicked = false;
    }
}

function bodyUnload() {
    if (clicked == false)//browser is closed
    {
        var request = GetRequest();
        request.open("GET", "~/Page/Login/AutoLogOut.aspx", true);
        request.send();
        //dung webservice

//        $.ajax({
//            type: "POST",
//            url: '<%=ResolveUrl("~/Webservice/WebService.asmx/KillSession")%>',
//            data: "{}",
//            contentType: "application/json; charset=utf-8",
//            dataType: "json",
//            success: function (data) {
//                alert("data.d.toString()");
//            }
//        });

    }
}

function GetRequest() {
    var request = null;
    if (window.XMLHttpRequest) {
        //incase of IE7,FF, Opera and Safari browser
        request = new XMLHttpRequest();
    }
    else {
        //for old browser like IE 6.x and IE 5.x
        request = new ActiveXObject('MSXML2.XMLHTTP.3.0');
    }
    return request;
}

function ClearAllSession() {
    alert("Clear all session  trung");
}